package com.zhihuichongcheng.application.ui.openclass.activity;

import android.app.DownloadManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.zhihuichongcheng.application.R;
import com.zhihuichongcheng.application.base.BaseActivity;
import com.zhihuichongcheng.application.ui.openclass.fragment.OpenClassStudyFragment;

/**
 * Created by 3water on 2016/11/2.
 */

public class OpenClassListActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_openclass_list);
        initView();
        initData();
    }

    private void initView()
    {

    }

    private void initData()
    {
        Intent intent = getIntent();
        String title ="";
        String id ="";
        if(intent!=null&&intent.hasExtra("title"))
        {
            title = intent.getStringExtra("title");
        }
        if(intent.hasExtra("allCategoryId"))
        {
            id = intent.getStringExtra("allCategoryId");
        }
        setTitle(title);
        setImRight(R.drawable.ic_download_list, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(DownloadManager.ACTION_VIEW_DOWNLOADS);
            }
        });
        OpenClassStudyFragment fragment = new OpenClassStudyFragment();
        //pass parameters to chat fragment
        Bundle bundle = new Bundle();
        bundle.putString("id",id);
        fragment.setArguments(bundle);
        getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
    }
}
